package com.devosaurusrex.simpleflashcards;

import java.io.File;
import java.util.LinkedList;

import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class DeckSelection extends Activity
{

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.file_chooser);
        ListView lv = (ListView)findViewById(R.id.file_chooser_listview);
        lv.setOnItemClickListener(new OnItemClickListener()
        {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                Toast.makeText(DeckSelection.this, ((File)view.getTag()).getName(), Toast.LENGTH_LONG).show();
                // fix
            }
            
        });
        File f = Environment.getExternalStorageDirectory();
        lv.setAdapter(new FileSelectionAdapter(this, R.layout.file_chooser_row, f.listFiles()));
        Flashcard f1 = new Flashcard("1f", "1b");
        Flashcard f2 = new Flashcard("2f", "2b");
        Deck d = new Deck();
        d.name = "test";
        d.cards = new LinkedList<Flashcard>();
        d.cards.add(f1);
        d.cards.add(f2);
        
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu)
    {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.deck_selection, menu);
        return true;
    }

}
